package com.woniuxy.dao;

import com.woniuxy.pojo.StopCar;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface StopCarMapper {
    int deleteByPrimaryKey(Long id);

    int insert(StopCar record);

    int insertSelective(StopCar record);

    StopCar selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StopCar record);

    int updateByPrimaryKey(StopCar record);

    @Select("select * from stopcar where status = 1")
    List<StopCar> findAllCar();

    @Select("select * from stopcar")
    List<StopCar> findEzstopCar();

    @Select("select * from stopcar where carnumber = #{carnumber} and status = 1")
    StopCar findCarByCarnumber(String carnumber);

    @Select("select * from stopcar where id = #{id} and status = 1")
    StopCar findCarById(Long id);

    @Update("UPDATE stopcar SET STATUS = 0,endtime = #{date} WHERE id =#{id}")
    void updateStatusById(@Param("id") Long id,@Param("date") Date date);
}